// createRouter 创建router实例对象
// createWebHistory 创建history模式路由

import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login/index.vue'
import Layout from '@/views/Layout/index.vue'
import Home from '@/views/Home/index.vue'
import Category from '@/views/Category/index.vue'

// 实例化路由对象
const router = createRouter({
    // 路由模式(暂不熟悉)
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            component: Layout,
            children: [
                {
                    // home页是默认页面 所以进行置空
                    path: '',
                    component: Home
                },
                {
                    path: 'category',
                    component: Category,
                }
            ]
        },
        {
            path: '/login',
            component:Login,
        }
    ]
})

// 导出路由
export default router
